undefined index REMOTE_ADDR for cron

January 9, 2010 · 462 views · 0 comments

undefined index REMOTE_ADDR for cron
taken by : Dedric Mauriac on Nowhereville (35, 221, 22)
blog HUD!

About

Now that I got cron jobs running, I started to see a bunch of errors in my log4php database. It turns out that PHP executed directly from the cgi bin (/web/cgi-bin/php5) instead of through a web browser, leaves out the headers. Since the job was running locally, there was no remote address to look at. I was able to clear up the problem with an "isset" call to determine if the index that I needed was available.This is a bit of a reliefe to me. I was concerned about people hacking the system by gaining access to this page and never completing the work, or providing bad data back to the site. Since I can detect local connections (those without headers), I can deny access to anyone else attempting to access the page through a web browser. From Dedric Mauriac via bloghud.com